package com.tony.thread;

public class ThreadTest1 extends Thread {

    private int threadNo;
    private String lock;
    public ThreadTest1(int threadNo){
        this.threadNo = threadNo;
    }

    public static void main(String[] args) throws InterruptedException {
        for(int i=0;i<5;i++){
            new ThreadTest1(i).start();
            Thread.sleep(1);
        }
    }
    @Override
    public void run() {

        for(int j=0;j<10;j++){
            System.out.println("this No is :"+threadNo+" value:"+j);
        }
        //runMethod(threadNo);
    }

    private synchronized void runMethod(int threadNo) {
        for(int j=0;j<10;j++){
            System.out.println("this No is :"+threadNo+" value:"+j);
        }
    }
}
